import request from 'utils/request'

/**
 *  获取文章列表
 * @param {*} params {参数}
 * @returns
 */
export const getArticleListApi = (params) => {
  return request({
    url: '/v1_0/mp/articles',
    method: 'GET',
    params,
  })
}

/**
 * 删除文章
 * @param {*} id
 * @returns
 */
export const delArticleListApi = (id) => {
  return request({
    url: '/v1_0/mp/articles/' + id,
    method: 'DELETE',
  })
}

/**
 * 添加文章/草稿
 * @param {*} data
 * @returns
 */
export const addArticleApi = (data) => {
  return request({
    url: '/v1_0/mp/articles?draft=' + data.draft,
    method: 'POST',
    data,
  })
}

/**
 * 获取文章详情
 * @param {*} id  文章Id
 * @returns
 */
export const getArticleDetailApi = (id) => {
  return request({
    url: '/v1_0/mp/articles/' + id,
    method: 'GET',
  })
}
